//
//  NewsTableViewCell.m
//  维度科技
//
//  Created by 刘敏 on 2019/1/24.
//  Copyright © 2019 谷银行. All rights reserved.
//

#import "NewsTableViewCell.h"

@implementation NewsTableViewCell
//设置头像
- (UIImageView *)Img{
    if (!_Img) {
        _Img = [[UIImageView alloc]init];
        _Img.image=[UIImage imageNamed:@"h1"];
    }
    return _Img;
}
//设置标题
- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab=[[UILabel alloc]init];
        _titleLab.text=@"张三";
        _titleLab.font=[UIFont systemFontOfSize:18];
        _titleLab.textColor=[UIColor darkGrayColor];
    }
    return _titleLab;
}
//设置副标题
- (UILabel *)detailLab{
    if (!_detailLab) {
        _detailLab=[[UILabel alloc]init];
        _detailLab.text=@"马上就要过年了";
        _detailLab.font=[UIFont systemFontOfSize:15];
        _detailLab.textColor=[UIColor lightGrayColor];
    }
    return _detailLab;
}
//设置时间
- (UILabel *)timeLab{
    if (!_timeLab) {
        _timeLab=[[UILabel alloc]init];
        _timeLab.text=@"22:30";
       _timeLab.font=[UIFont systemFontOfSize:15];
        _timeLab.textColor=[UIColor lightGrayColor];
    }
    return _timeLab;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addSubview:self.Img];
        [self addSubview:self.titleLab];
        [self addSubview:self.detailLab];
        [self addSubview:self.timeLab];
        [self sdauto];
    }
    return self;
}
- (void)sdauto{
    
    _Img.sd_layout
    .topSpaceToView(self,10)
    .leftSpaceToView(self,10)
    .widthIs(50)
    .heightIs(50);
    
    _titleLab.sd_layout
    .topSpaceToView(self, 10)
    .leftSpaceToView(self.Img, 10)
    .widthIs(100)
    .heightIs(20);
    
    _detailLab.sd_layout
    .topSpaceToView(self, 40)
    .leftSpaceToView(self.Img, 10)
    .widthIs(200)
    .heightIs(20);
    
    _timeLab.sd_layout
    .topSpaceToView(self, 30)
    .rightSpaceToView(self, -20)
    .widthIs(100)
    .heightIs(20);
    
}


@end
